<% layout('/layouts/default.html', {title: '任务部署信息表(主)管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<#form:form id="searchForm" model="${dcSupTaskInfo}" action="${ctx}/taskdeploy/dcSupTaskInfo/queryListData?normalFlag=4" method="post" class="form-inline"
			data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
			<div style="float: right">
				<div class="form-group">
					<label class="control-label">${text('任务年度')}：</label>
					<div class="control-inline width-120">
						<#form:select path="taskYear" items="${yearList}" blankOption="true" data-placeholder="请选择" itemLabel="yearLabel" itemValue="yearValue" class="form-control width-120" defaultValue="${currentYear}"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('任务标题')}：</label>
					<div class="control-inline width-160">
						<#form:input path="taskTitle" maxlength="200" class="form-control width-160" placeholder="请输入任务标题"/>
					</div>
				</div>
				<div class="form-group">
					<label class="control-label">${text('任务类型')}：</label>
					<div class="control-inline width-160">
						<#form:select path="taskTypeCode" items="${dicts}" blankOption="true" data-placeholder="请选择" itemLabel="dictLabel" itemValue="dictValue" class="form-control width-160"/>
					</div>
				</div>
				<div class="form-group">
					<!--					<label class="control-label">${text('数据过滤')}：</label>-->
					<div class="control-inline width-90">
						<% if(hasRole('other_office')){ %>
						<% var items = [{label:'我的',value:'0'}]; %>
						<#form:select path="dataLimit" items="${items}" itemLabel="label" itemValue="value" defaultValue="0" class="form-control required" />
						<% } else{ %>
						<% var items = [{label:'我的',value:'0'},{label:'本单位',value:'1'}]; %>
						<#form:select path="dataLimit" items="${items}" itemLabel="label" itemValue="value" defaultValue="0" class="form-control required" />
						<% } %>
					</div>
				</div>
				<div class="form-group" >
					<button type="submit" class="btn btn-primary btn-sm">${text('查询')}</button>
					<button onclick="cz();" class="btn btn-default btn-sm">${text('重置')}</button>
				</div>

			</div>
		</#form:form>
		</div>
		<div class="box-body">
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script>
	//重置
	$(function () {
		if('${dcSupTaskInfo.remarks3}'){
			$("#dataGrid").jqGrid('GridUnload');
			 $("#pageNo").val('${dcSupTaskInfo.remarks3}');
			$("#pageSize").val('${dcSupTaskInfo.remarks4}');
			$('#dataGrid').dataGrid({
				searchForm: $("#searchForm"),
				sortableColumn: false, // 列表不允许排序
				columnModel: [
					{header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", hidden:true},
					{header:'${text("督办字号")}', name:'messageNumber', index:'a.message_number', width:100, align:"left"},
					{header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left"
						, formatter: function(val, obj, row, act){
							var pageNo = $("#pageNo").val();
							var pageSize = $("#pageSize").val();
							return '<a href="${ctx}/action/dcSupTaskAction/listOrg?taskId='+row.id+'&normalFlag=4&remarks3='+pageNo+'&remarks4='+pageSize+'" class="btnList" data-title="${text("牵头责任单位详情")}">'+(val||'暂无标题')+'</a>';}

					},
					{header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_name', width:150, align:"left"},
					{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left", formatter: function(val, obj, row, act){
							return '<a href="${ctx}/taskdeploy/dcSupTaskInfo/detailForm?id='+row.id+'" class="btnList" data-title="${text("督办任务信息")}">'+(val||'暂无内容')+'</a>';
						}},
					/*	{header:'${text("调度人")}', name:'contactName', index:'a.contact_name', width:100, align:"left"},*/
					{header:'${text("牵头责任单位")}', name:'taskLeaderOrgName', index:'a.task_leader_org_name', width:250, align:"left"},
				],
				page: '${dcSupTaskInfo.remarks3}',	// 当前页码
				rowNum: '${dcSupTaskInfo.remarks4}',
				// 加载成功后执行事件
				ajaxSuccess: function(data){

				}
			});
		}
	})

	function cz(){
		searchForm.reset();
		$('#dataGrid').dataGrid('reloadGrid');
	}

	// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	sortableColumn: false, // 列表不允许排序
	columnModel: [
		{header:'${text("主键")}', name:'id', index:'a.id', width:150, align:"left", hidden:true},
		{header:'${text("督办字号")}', name:'messageNumber', index:'a.message_number', width:100, align:"left"},
		{header:'${text("任务标题")}', name:'taskTitle', index:'a.task_title', width:150, align:"left"
			, formatter: function(val, obj, row, act){
				var pageNo = $("#pageNo").val();
				var pageSize = $("#pageSize").val();
				return '<a href="${ctx}/action/dcSupTaskAction/listOrg?remarks1=1&taskId='+row.id+'&normalFlag=4&remarks3='+pageNo+'&remarks4='+pageSize+'"  class="btnList" data-title="${text("牵头责任单位详情")}">'+(val||'暂无标题')+'</a>';}

		},
		{header:'${text("任务类型")}', name:'taskTypeName', index:'a.task_type_name', width:150, align:"left"},
		{header:'${text("任务内容")}', name:'taskContent', index:'a.task_content', width:150, align:"left", formatter: function(val, obj, row, act){
				return '<a href="${ctx}/taskdeploy/dcSupTaskInfo/detailForm?id='+row.id+'" class="btnList" data-title="${text("督办任务信息")}">'+(val||'暂无内容')+'</a>';
			}},
	/*	{header:'${text("调度人")}', name:'contactName', index:'a.contact_name', width:100, align:"left"},*/
		{header:'${text("协同单位")}', name:'taskLeaderOrgName', index:'a.task_leader_org_name', width:250, align:"left"
			,formatter:function (val,obj,row,act) {
				return '<a   href="#" onclick=showTaskLeaderOrg("' + row.id + '")   >'+val+'</a>'
			}},
	],
	// 加载成功后执行事件
	ajaxSuccess: function(data){

	}
});

	function showSubTask(id) {
		js.addTabPage(null, "子任务明细","${ctx}/action/dcSupTaskAction/listOrg?taskId="+id , true);
	}

	function editTask(id) {
		js.addTabPage(null, "编辑督办任务","${ctx}/taskdeploy/dcSupTaskInfo/form?id="+id , true);
	}
	function arrangeTask(taskId){
		js.addTabPage(null, "整理内容","${ctx}/taskdeploy/dcSupTaskInfo/arrangeTask?taskId="+taskId , true);
	}

	function arrangeHis(id) {
		js.layer.open({
			type: 2,
			title: ['整理历史'],
			area: ['1000px', '860px'],
			scrollbar: true,
			shadeClose: false,
			content: "${ctx}/arrange/dcSupTaskInfoArrange?taskId="+id,
			btn1: function (index, layero) {
			},
			end:function () {
				$('#dataGrid').dataGrid('refresh', 1, 20);
			}
		});
	}

	function showTaskLeaderOrg(taskNo) {
		js.layer.open({
			type: 2,
			title: '牵头责任单位',
			area: ['700px', '500px'],
			content: "${ctx}/taskdeploy/dcSupTaskInfo/showTaskLeaderOrg?taskNo=" + taskNo,
			btn: [],
			btn1: function (index, layero) {

			}
		});
	}
</script>
<style>
	.dbd{
		padding: 10px;
		border-bottom: 1px solid gray;
		border-right: 1px solid gray;
		border-left: 1px solid gray;
		margin: auto 10px;
	}
	.dbd:nth-child(1){
		padding: 10px;
		border-bottom: 1px solid gray;
		border-top: 1px solid gray;
	}
	.xbd{
		margin-left: 10px;
	}
</style>